package com.fenghuajueli.module_find_the_difference.fragment;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.fenghuajueli.module_find_the_difference.R;

public class ZhaochaActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.module_find_the_difference_activity_zhaocha);
        // 获取FragmentManager
        FragmentManager fragmentManager = getSupportFragmentManager();

        // 开始一个FragmentTransaction
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

        // 创建或获取一个Fragment实例
        Fragment myFragment = new ZhaochaFragment();

        // 将Fragment添加到Activity中，指定一个视图容器（FrameLayout）和Fragment的ID
        fragmentTransaction.add(R.id.fm, myFragment, "myFragmentTag");

        // 提交事务
        fragmentTransaction.commit();
    }
}
